package com.neusoft.elmboot.mapper;

import java.util.List;

import com.neusoft.elmboot.dto.FoodDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.neusoft.elmboot.po.Food;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface FoodMapper {

	@Select("select * from food where businessId=#{businessId} order by foodId")
	public List<Food> listFoodByBusinessId(Integer businessId);
	
	@Select("select * from food where foodId=#{foodId} FOR UPDATE")
	public Food getFoodById(Integer foodId);

	@Update("update food set count=#{count} where foodId=#{foodId} ")
	public int updateFoodCount(Food food);

	@Select("SELECT * FROM food WHERE businessId=#{businessId} AND foodName LIKE CONCAT('%',#{keyword},'%')")
	public List<Food> searchFood(FoodDTO foodDTO);
}
